<div class="panel-search">	
	<form action="<?php print base_url(); ?>cafe/search" method="get">
		<div class="row-fluid">
			<div class="span7">
				<ul class="unstyled">
					<li>คำค้น</li>
					<li><input name="key" type="text" /></li>
					<li>จังหวัด</li>
					<li><?php print form_dropdown('pv', $province_list, null); ?></li>		
				</ul>		
			</div>
			<div class="span5">
				<label>ประเภทร้าน</label>
				<?php for ($i=0; $i<count($cafe_type_list); $i++){ ?>
					<label class="checkbox">
						<input type="checkbox" name="t[]" value="<?php print $cafe_type_list[$i]['CAF_T_ID']; ?>">
					  	<?php print $cafe_type_list[$i]['CAF_T_TITLE']; ?>
					</label>
				<?php } ?>
			</div>
		</div>
		<div class="text-center">
			<button class="btn btn-primary">ค้นหา</button>			
		</div>
	</form>	
</div>
<hr />
<div>	
	<ul class="unstyled thumb-list">
		<?php if (isset($cafe_list) && count($cafe_list) > 0): 
				for ($i=0; $i<count($cafe_list); $i++){ ?>
					<li class="underline row-fluid">						
						<img class="thumb" src="<?php print $cafe_list[$i]['CAF_IMG_L_FILENAME']; ?>" style="width:70px; height:70px;" />						
						<div class="span5">
							<ul class="unstyled">
								<li style="height:45px; font-size:12pt;"><a href="<?php print base_url() . $cafe_list[$i]['CAF_NAME']; ?>" target="_blank"><?php print $cafe_list[$i]['CAF_TITLE']; ?></a></li>
								<li style="font-size:10pt;">จังหวัด: <?php print implode(',', array_unique($cafe_list[$i]['PROVINCE_LIST'])); ?></li>
							</ul>						
						</div>
						<div class="span5 text-right">
							<ul class="unstyled inline">													
							<?php for ($j=0; $j<count($cafe_list[$i]['CAF_IMG_C_LIST']); $j++) {?>
								<li><img class="thumbnail preview-thumbnail" style="width:60px; height:40px;" 
										style="margin:0 -5px; cursor:hand; cursor:pointer" 
										src="<?php print $cafe_list[$i]['CAF_IMG_C_LIST'][$j]['CAF_IMG_C_FILENAME']; ?>" 
										rel="popover" data-trigger="hover" data-placement="left" 
										data-content="<img src='<?php print $cafe_list[$i]['CAF_IMG_C_LIST'][$j]['CAF_IMG_C_FILENAME']; ?>' />"/></li>
							<?php } ?>
							</ul>
						</div>
					</li>
		<?php 	}
			  else: ?>
			  	<p class="alert text-center">				 
					<strong>ไม่พบข้อมูล</strong>
				</p>
		<?php endif;?>
	</ul>	
</div>          
<div>
	<div class="pagination">
	<?php if ($page_count > 0):?>	
		<ul>
		    <li><a href="<?php print base_url() . 'cafe/search?p=1'; ?>">First</a></li>    
		    <?php for ($i=0; $i<$page_count; $i++) {?>
		      	<li><a href="<?php print base_url() . 'cafe/search/?p=' . ($i+1); ?>"><?php print $i+1; ?></a></li>
		    <?php }?>
		    <li><a href="<?php print base_url() . 'cafe/search?p=' . $page_count; ?>">Last</a></li>
		</ul>
	<?php endif; ?>
	</div>	
</div>

<script type="text/javascript">
	$('.preview-thumbnail').popover({ html: true });
</script>
